Skip to content

Setting keys will be stored on const strings#3750

Merged
Martí Climent (marticliment) merged 12 commits into
mainfrom
use-const-strings-for-settings-names
Jun 16, 2025
Merged

Setting keys will be stored on const strings#3750
Martí Climent (marticliment) merged 12 commits into
mainfrom
use-const-strings-for-settings-names

Conversation

@marticliment
Copy link
Copy Markdown
Collaborator

@marticliment Martí Climent (marticliment) commented Jun 15, 2025

For easier coding, settings keys will be stored on const strings an enumeration

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the way settings keys are accessed throughout the codebase by replacing string literals with enum-based constant keys for improved consistency and ease of use. Key changes include:

  • Replacing literal string keys with enums (Settings.K and SecureSettings.K) in various managers and helper classes.
  • Updating test cases to use the new keys.
  • Refining dictionary handling and logging in SettingsEngine components.

Reviewed Changes

Copilot reviewed 62 out of 62 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/UniGetUI.PackageEngine.Managers.PowerShell7/PowerShell7.cs Updated redundant namespace reference for UTF8 encoding.
src/UniGetUI.PackageEngine.Managers.Pip/Pip.cs Replaced string literal settings keys with enum keys.
src/UniGetUI.PackageEngine.Managers.Pip/Helpers/PipPkgDetailsHelper.cs Updated log type reference to use enum instead of qualified string.
src/UniGetUI.PackageEngine.Managers.Generic.NuGet/BaseNuGet.cs Refactored Settings.Get calls to use key enums.
src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs Updated various settings key usage and commented out obsolete code remains intact.
src/UniGetUI.Interface.Telemetry/TelemetryHandler.cs Refactored settings key usage and updated telemetry bitmask generation.
src/UniGetUI.Interface.BackgroundApi/BackgroundApi.cs Updated Settings.SetValue call to use enum key.
src/UniGetUI.Core.Tools/Tools.cs Refactored proxy settings key usage.
src/UniGetUI.Core.Tools/DWMThreadHelper.cs Refactored settings key checks for thread optimizations.
src/UniGetUI.Core.Tools.Tests/MetaTests.cs Updated error messages to reflect key enum usage.
src/UniGetUI.Core.Settings/* Refactored settings engine (Names, Extras, Dictionaries, Engine, Tests) to consistently use enum keys.
src/UniGetUI.Core.SecureSettings/SecureSettings.cs Migrated secure settings to enum-based keys.
src/UniGetUI.Core.LanguageEngine/* Updated language engine to use enum keys for PreferredLanguage and related settings.
src/UniGetUI.Core.IconStore/IconDatabase.cs Updated IconDataBaseURL retrieval to use enum keys.
Comments suppressed due to low confidence (2)

src/UniGetUI.Interface.Telemetry/TelemetryHandler.cs:86

  • Consider adding a comment explaining that the check 'if (mask == 0x1)' serves as an overflow guard in the bit-shift operation within the settings magic value calculation.
if (mask == 0x1)

src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs:16

  • [nitpick] Consider renaming the local variable 'setting' to 'resolvedKey' for improved clarity about its purpose.
string setting = ResolveKey(key);

@marticliment Martí Climent (marticliment) marked this pull request as ready for review June 16, 2025 12:38
@marticliment Martí Climent (marticliment) merged commit b9ce3c5 into main Jun 16, 2025
2 checks passed
@griush
Copy link
Copy Markdown

estudia coño, tot el dia fent PRs

@marticliment
Copy link
Copy Markdown
Collaborator Author

que pesao jajajajaj ves a estudiar BD

@marticliment Martí Climent (marticliment) deleted the use-const-strings-for-settings-names branch July 18, 2025 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants